package com.zaydanwu.cla.controller.students;

import com.zaydanwu.cla.model.TeacherMessage;
import com.zaydanwu.cla.model.result.ApiResult;
import com.zaydanwu.cla.service.TeacherMessageService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @BelongsProject: cla
 * @BelongsPackage: com.zaydanwu.cla.controller.students
 * @Author: zaydanwu
 * @CreateTime: 2018-12-10 22:56
 * @Description:
 */
@RestController
@RequestMapping("/cla/api")
public class TeacherMessageController {

    @Resource
    private TeacherMessageService teacherMessageService;

    @RequestMapping("/getTeacherMessage")
    public ApiResult<TeacherMessage> getTeacherMessage(@RequestParam String name) {
        TeacherMessage teacherMessage = teacherMessageService.getTeacherMessage(name);
        return ApiResult.success(teacherMessage);
    }

    @RequestMapping("/saveTeacherMessage")
    public ApiResult<Integer> saveTeacherMessage(@RequestBody TeacherMessage teacherMessage) {
        int i = teacherMessageService.saveTeacherMessage(teacherMessage);
        return ApiResult.success(i);
    }

}
